require 'mysql2'
require 'digest/md5'
require 'fileutils'
host = '127.0.0.1'
database = 'rate3'
password = 'testing'
con = Mysql2::Client.new(host: host, username: 'root', password: password, database: database)

file = File.open('results.txt', 'r')

import_tag = 'develop'

20.times do
	class_uuid = file.gets.chomp
	samples = []
	con.query("INSERT INTO class(uuid, type, import_tag) VALUES(UNHEX('#{class_uuid}'),'FINGERVEIN', '#{import_tag}')")
	10.times do
		uuid, filename = file.gets.chomp.split(" ")
		filename = filename.split("\\")[-1]
		con.query("INSERT INTO sample(uuid, class_uuid, file, import_tag) VALUES(UNHEX('#{uuid}'), UNHEX('#{class_uuid}'), '#{filename}', '#{import_tag}')")
	end
end

file.close
